#include "heaplist.h"
#include "heaphelp.h"

struct data
{
    void* start;//managed_memory_start
    void* last;//last_valid_address
    //char* swap_path;
    int has_initialised;
    int fd;
    off_t off;
    list_t list;//list of nodes in swap
    list_t swap_list;//list of free space (which was freed) in swap
    size_t mem;
    size_t swap;
    size_t id;
    int end;//if we've run out of valid ids=>1 else 0
};

struct mem_control_block
{
    int is_available;//if 1 than available
    size_t size;
    size_t id;
    void* memloc;
    off_t off;//for swap
    int is_mapped;//1 if it is mapped
};//it is before each chunk, consists of metadata about this particular chunk

struct data* data_t;

size_t ma_alloc(size_t size);
void* ma_get(size_t id);
int ma_release(size_t id);
int ma_free(size_t id);
int ma_init(size_t mem, size_t swap, const char* swap_path);
void ma_deinit();
